<?php
/******************************************
 * Author: <YOUR NAME HERE>
 * Description: <YOUR DESCRIPTION HERE>
 ******************************************/
class Userteams  extends CustomSecurity { 

	var $db; 
	var $teamName;
	var $teamID;
	var $teamPoints;
	var $p1;
	var $p2;
	var $p3;
	var $p4;
	var $shirt;

	function Userteams($db){ 
          $this->db = $db; 
    }

	/***********************************
 	 * Add:         Allows the insertion of values into the Table.
 	 * Parameters:  $teamName, $teamID, $teamPoints, $p1, $p2, $p3, $p4, $shirt
 	 * Return:      (Boolean) True - Successfully Inserted | False - Error
 	 ************************************/
	function add($teamName, $teamID, $teamPoints, $p1, $p2, $p3, $p4, $shirt){ 

		//Custom SQL Injection Escaping HERE

		$statement = "INSERT INTO Userteams (teamName, teamID, teamPoints, p1, p2, p3, p4, shirt) VALUES ('$teamName', '$teamID', '$teamPoints', '$p1', '$p2', '$p3', '$p4', '$shirt');";
		$results   = $this->db->query($statement);

		if($results){
			return true;
		}else{
			return false;
		}

	}//End add()


	/***********************************
 	 * Remove:      Allows for the removal of record from the database.
 	 * Parameters:  (String)Primary Key Column Name | (Int) Primary Key Value
 	 * Return:      (Boolean) True - Successfully Removed | False - Error
 	 ************************************/
	function remove($primaryKeyName, $primaryKeyValue){ 

		//Custom SQL Injection Escaping HERE

		$statement = "DELETE FROM Userteams WHERE $primaryKeyName = '$primaryKeyValue'";
		$results   = $this->db->query($statement);
		if($results){
			return true;
		}else{
			return false;
		}

	}//End remove()


	/***********************************
 	 * Update:      Allows for the update of a record from the database.
 	 * Parameters:  (String)Primary Key Column Name | (Int) Primary Key Value | (String) Column Name To Update | (String) New Value
 	 * Return:      (Boolean) True - Successfully Updated | False - Error
 	 ************************************/
	function update($primaryKeyName, $primaryKeyValue, $columnNameToUpdate, $columnValue){ 

		//Custom SQL Injection Escaping HERE

		$statement = "UPDATE Userteams SET $columnNameToUpdate = '$columnValue' WHERE $primaryKeyName = '$primaryKeyValue'";
		$results   = $this->db->query($statement);
		if($results){
			return true;
		}else{
			return false;
		}

	}//End update()


	/***********************************
 	 * GetAll:       Returns all the records in the database.
 	 * Parameters:   NA
 	 * Return:      (MultiDimensional-Array)String
 	 ************************************/
	function getAll(){ 

		//Custom SQL Injection Escaping HERE

		$statement = "SELECT teamName, teamID, teamPoints, p1, p2, p3, p4, shirt FROM Userteams";
		$results   = $this->db->getAll($statement);

		return $results;

	}//End getAll()


	/***********************************
 	 * GetObject:   Returns a specific record form the batabase.
 	 * Parameters:  (Int) Primary Key Value
 	 * Return:      (Array)String
 	 ************************************/
	function getObject($primaryKeyName, $primaryKeyValue){ 

		//Custom SQL Injection Escaping HERE

		$statement = "SELECT teamName, teamID, teamPoints, p1, p2, p3, p4, shirt FROM Userteams WHERE ".$primaryKeyName." = '".$primaryKeyValue."'";
		$results   = $this->db->getAll($statement);

		return $results;

	}//End getObject()


}//End Class Userteams
?>